package array;

/**
 * @Author Stringzhua
 * @Date 2025/10/27 17:33
 * description:
 */
public class test02 {
    public static void main(String[] args) {
        // 创建整数数组
        int[] numbers = {10, 20, 30, 40, 50};
        // 打印修改前的数组
        System.out.print("修改前的数组: [");
        for (int i = 0; i < numbers.length; i++) {
            System.out.print(numbers[i]);
            if (i < numbers.length - 1) {
                System.out.print(", ");
            }
        }
        System.out.println("]");

        // 通过索引修改元素值
        numbers[2] = 35;
        // 打印修改后的数组
        System.out.print("修改后的数组: [");
        for (int i = 0; i < numbers.length; i++) {
            System.out.print(numbers[i]);
            if (i < numbers.length - 1) {
                System.out.print(", ");
            }
        }
        System.out.println("]");
    }
}
